package com.formula.propertyshop.view.phone;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.Window;

import com.formula.propertyshop.R;
import com.formula.propertyshop.adapter.PropertyImagePagerAdapter;
import com.formula.propertyshop.model.PropertyDetail;
import com.formula.propertyshop.utils.Const;
import com.formula.propertyshop.utils.WFUtils;
import com.formula.propertyshop.view.common.NetWorkErrorActivity;

public class PropertyImage extends Activity{
	private ViewPager viewPager;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		 if(!WFUtils.checkInternetConnection(this)){
	        	Intent intent = new Intent(this,NetWorkErrorActivity.class);
	    		intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
	    		startActivityForResult(intent, Const.NETWORK_ACTIVITY_REQUEST_CODE);
 			return;
 		}
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.property_image);
		viewPager = (ViewPager) findViewById(R.id.pager);
		PropertyDetail property = (PropertyDetail) getIntent().getSerializableExtra(Const.PROPERTYID);
		PropertyImagePagerAdapter adapter = new PropertyImagePagerAdapter(this, WFUtils.removeNull(property.getImgGalleryUrl()));
		viewPager.setAdapter(adapter);
		
	}
}
